#include "Spl_list.h" 

//创建单链表
Link_list* init_link_list()
{
    Link_list* L = (Link_list*) malloc(sizeof(Link_list));
    if (NULL == L)
    {
        printf("创建失败\n");
        return NULL;
    }
    else
    L->head = NULL;
    
    return L;
}

//遍历单链表
void print_link_list(Link_list* list)
{
    if (NULL == list)
    {
        printf("单链表不存在\n");
        return;
    }
    if (0 == list->head)
    {
        printf("单链表为空\n");
        return;
    }
    Node *node = list->head;
    while (node != NULL)
    {
        printf("姓名:%s 性别:%s 年龄:%d 成绩:%d 学号:%d\n",
        node->data.name , node->data.sex , node->data.age , 
        node->data.sco  , node->data.id 
        );
        node = node->next;
    }
}
